package office.dao.hr;

import platform.common.dao.impl.BaseDomainProviderImpl;

public class BecomeRegularDP extends BaseDomainProviderImpl{

	/**
	 * 获取某用户的转正申请
	 * @return
	 */
	public String getFindBecomeRegularByUserId(){
		return "select new office.action.hr.form.BecomeRegularForm(b.cname,a.userId,a.id,b.office," +
		"a.appointmentDate,a.entryDate,a.trialPeriodDuty,a.trialPeriodTaste,a.state,a.entryRole,a.checkRole,b.department.name) from "+this.getDomainClassName()+
		" a,User b where a.userId=:userId and a.userId = b.id";
	}
	/**
	 * 获取某用户的转正申请
	 * @return
	 */
	public String getFindBecomeRegularById(){
		return "select new office.action.hr.form.BecomeRegularForm(b.cname,a.userId,a.id,b.office," +
		"a.appointmentDate,a.entryDate,a.trialPeriodDuty,a.trialPeriodTaste,a.state,a.entryRole,a.checkRole,b.department.name) from "+this.getDomainClassName()+
		" a,User b where a.id=:id and a.userId = b.id";
	}
	
	
	/**
	 * 获取某用户提交的或需要自己审批的转正申请
	 * @return
	 */
	public String getFindByUserIdCheckRole(){
		return "select new office.action.hr.form.BecomeRegularForm(b.cname,a.userId,a.id,b.office," +
		"a.appointmentDate,a.entryDate,a.trialPeriodDuty,a.trialPeriodTaste,a.state,a.entryRole,a.checkRole,b.department.name) from "+this.getDomainClassName()+
		" a,User b where (a.userId=:userId or checkRole =:checkRole) and a.userId = b.id  ";
	}
	/**
	 * 获取某用户提交的或需要自己审批的转正申请(销售人员、区域经理、销售经理需要限制是和自己同一部门人提交审批的记录)
	 * @return
	 */
	public String getFindByUserIdCheckRoleDept(){
		return "select new office.action.hr.form.BecomeRegularForm(b.cname,a.userId,a.id,b.office," +
		"a.appointmentDate,a.entryDate,a.trialPeriodDuty,a.trialPeriodTaste,a.state,a.entryRole,a.checkRole,b.department.name) from "+this.getDomainClassName()+
		" a,User b where (a.userId=:userId or checkRole =:checkRole) and a.userId = b.id  and b.department.id in (:deptId)";
	}
}
